package com.jiangjiang.eshop.inventory.async;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Observable;
import java.util.Observer;

/**
 * @ClassName StockUpdateObserver
 * @Description 库存更新结果观察者
 * @Author jhw
 * @Date 2021/6/14 15:34
 * @Version 1.0
 **/
@Slf4j
@Component
public class StockUpdateObserver implements Observer {
    /**
     * 通过异步处理结果
     */
    @Override
    public void update(Observable o, Object arg) {
        StockUpdateResult result  = (StockUpdateResult) arg;
        log.info("商品库存更新消息[messageId=" + result.getMessageId() + "]"
                + "的异步处理结果为：" + result.getResult());
    }
}
